import {useI18n} from "vue-i18n";
import {computed} from "vue";
import Local from "@/utils/local";

const useLocale = () => {
    const i18 = useI18n()
    // 当前语言
    const currentLocale = computed(() => i18.locale.value)
    // 修改语言
    const changeLocale = (locale: string) => {
        i18.locale.value = locale
        Local.localSave('language', locale)
    }

    return {
        currentLocale,
        changeLocale
    }
}


export default useLocale